package com.ruoyi.edit.controller;

import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.edit.domain.DevelopUser;
import com.ruoyi.edit.service.IDevelopUserService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 核检用户统计Controller
 * 
 * @author qiufeng
 * @date 2022-05-10
 */
@Controller
@RequestMapping("/system/developUser")
public class DevelopUserController extends BaseController
{
    private String prefix = "system/developUser";

    @Autowired
    private IDevelopUserService developUserService;

    @GetMapping()
    public String developUser()
    {
        return prefix + "/developUser";
    }


    /**
     * 查询核检用户统计列表
     */
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(DevelopUser developUser)
    {
        startPage();
        List<DevelopUser> list = developUserService.selectDevelopUserList(developUser);
        return getDataTable(list);
    }

    /**
     * 导出核检用户统计列表
     */
    @Log(title = "核检用户统计", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(DevelopUser developUser)
    {
        List<DevelopUser> list = developUserService.selectDevelopUserList(developUser);
        ExcelUtil<DevelopUser> util = new ExcelUtil<DevelopUser>(DevelopUser.class);
        return util.exportExcel(list, "核检用户统计数据");
    }

    /**
     * 新增核检用户统计
     */
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存核检用户统计
     */
    @Log(title = "核检用户统计", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(DevelopUser developUser)
    {
        return toAjax(developUserService.insertDevelopUser(developUser));
    }

    /**
     * 修改核检用户统计
     */
    @GetMapping("/edit/{id}")
    public String edit(@PathVariable("id") String id, ModelMap mmap)
    {
        DevelopUser developUser = developUserService.selectDevelopUserById(id);
        mmap.put("developUser", developUser);
        return prefix + "/edit";
    }

    /**
     * 修改保存核检用户统计
     */
    @Log(title = "核检用户统计", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(DevelopUser developUser)
    {
        return toAjax(developUserService.updateDevelopUser(developUser));
    }

    /**
     * 删除核检用户统计
     */
    @Log(title = "核检用户统计", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(developUserService.deleteDevelopUserByIds(ids));
    }
}
